<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>testing.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_html_testing.js.html">testing.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2013 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Utilities to create arbitrary values of goog.html types for
<a name="line17"></a> * testing purposes. These utility methods perform no validation, and the
<a name="line18"></a> * resulting instances may violate type contracts.
<a name="line19"></a> *
<a name="line20"></a> * These methods are useful when types are constructed in a manner where using
<a name="line21"></a> * the production API is too inconvenient. Please do use the production API
<a name="line22"></a> * whenever possible; there is value in having tests reflect common usage and it
<a name="line23"></a> * avoids, by design, non-contract complying instances from being created.
<a name="line24"></a> */
<a name="line25"></a>
<a name="line26"></a>
<a name="line27"></a>goog.provide(&#39;goog.html.testing&#39;);
<a name="line28"></a>goog.setTestOnly();
<a name="line29"></a>
<a name="line30"></a>goog.require(&#39;goog.html.SafeHtml&#39;);
<a name="line31"></a>goog.require(&#39;goog.html.SafeStyle&#39;);
<a name="line32"></a>goog.require(&#39;goog.html.SafeUrl&#39;);
<a name="line33"></a>goog.require(&#39;goog.html.TrustedResourceUrl&#39;);
<a name="line34"></a>
<a name="line35"></a>
<a name="line36"></a>/**
<a name="line37"></a> * Creates a SafeHtml wrapping the given value. No validation is performed.
<a name="line38"></a> *
<a name="line39"></a> * This function is for use in tests only and must never be used in production
<a name="line40"></a> * code.
<a name="line41"></a> *
<a name="line42"></a> * @param {string} html The string to wrap into a SafeHtml.
<a name="line43"></a> * @param {?goog.i18n.bidi.Dir=} opt_dir The optional directionality of the
<a name="line44"></a> *     SafeHtml to be constructed. A null or undefined value signifies an
<a name="line45"></a> *     unknown directionality.
<a name="line46"></a> * @return {!goog.html.SafeHtml}
<a name="line47"></a> * @suppress {visibility} For access to SafeHtml.create...  Note that this
<a name="line48"></a> *     use is appropriate since this method is intended to be &quot;package private&quot;
<a name="line49"></a> *     within goog.html.  DO NOT call SafeHtml.create... from outside this
<a name="line50"></a> *     package; use appropriate wrappers instead.
<a name="line51"></a> */
<a name="line52"></a>goog.html.testing.newSafeHtmlForTest = function(html, opt_dir) {
<a name="line53"></a>  return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse_(
<a name="line54"></a>      html, (opt_dir == undefined ? null : opt_dir));
<a name="line55"></a>};
<a name="line56"></a>
<a name="line57"></a>
<a name="line58"></a>/**
<a name="line59"></a> * Creates a SafeStyle wrapping the given value. No validation is performed.
<a name="line60"></a> *
<a name="line61"></a> * This function is for use in tests only and must never be used in production
<a name="line62"></a> * code.
<a name="line63"></a> *
<a name="line64"></a> * @param {string} style String to wrap into a SafeStyle.
<a name="line65"></a> * @return {!goog.html.SafeStyle}
<a name="line66"></a> * @suppress {visibility} For access to SafeStyle.create...  Note that this
<a name="line67"></a> *     use is appropriate since this method is intended to be &quot;package private&quot;
<a name="line68"></a> *     within goog.html.  DO NOT call SafeStyle.create... from outside this
<a name="line69"></a> *     package; use appropriate wrappers instead.
<a name="line70"></a> */
<a name="line71"></a>goog.html.testing.newSafeStyleForTest = function(style) {
<a name="line72"></a>  return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse_(
<a name="line73"></a>      style);
<a name="line74"></a>};
<a name="line75"></a>
<a name="line76"></a>
<a name="line77"></a>/**
<a name="line78"></a> * Creates a SafeUrl wrapping the given value. No validation is performed.
<a name="line79"></a> *
<a name="line80"></a> * This function is for use in tests only and must never be used in production
<a name="line81"></a> * code.
<a name="line82"></a> *
<a name="line83"></a> * @param {string} url String to wrap into a SafeUrl.
<a name="line84"></a> * @return {!goog.html.SafeUrl}
<a name="line85"></a> * @suppress {visibility} For access to SafeUrl.create...  Note that this
<a name="line86"></a> *     use is appropriate since this method is intended to be &quot;package private&quot;
<a name="line87"></a> *     within goog.html.  DO NOT call SafeUrl.create... from outside this
<a name="line88"></a> *     package; use appropriate wrappers instead.
<a name="line89"></a> */
<a name="line90"></a>goog.html.testing.newSafeUrlForTest = function(url) {
<a name="line91"></a>  return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse_(url);
<a name="line92"></a>};
<a name="line93"></a>
<a name="line94"></a>
<a name="line95"></a>/**
<a name="line96"></a> * Creates a TrustedResourceUrl wrapping the given value. No validation is
<a name="line97"></a> * performed.
<a name="line98"></a> *
<a name="line99"></a> * This function is for use in tests only and must never be used in production
<a name="line100"></a> * code.
<a name="line101"></a> *
<a name="line102"></a> * @param {string} url String to wrap into a TrustedResourceUrl.
<a name="line103"></a> * @return {!goog.html.TrustedResourceUrl}
<a name="line104"></a> * @suppress {visibility} For access to TrustedResourceUrl.create...  Note that
<a name="line105"></a> *     this use is appropriate since this method is intended to be
<a name="line106"></a> *     &quot;package private&quot; within goog.html.  DO NOT call
<a name="line107"></a> *     TrustedResourceUrl.create... from outside this package; use appropriate
<a name="line108"></a> *     wrappers instead.
<a name="line109"></a> */
<a name="line110"></a>goog.html.testing.newTrustedResourceUrlForTest = function(url) {
<a name="line111"></a>  return goog.html.TrustedResourceUrl.
<a name="line112"></a>      createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse_(url);
<a name="line113"></a>};
</pre>


</body>
</html>
